package cn.nfwx.tv.down.bean;


import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.IntRange;

import java.io.Serializable;

import cn.nfwx.tv.down.config.InnerConstant;
import cn.nfwx.tv.down.utils.DebugUtils;

public class RequestInfo implements Parcelable {

    @IntRange(from = InnerConstant.Request.loading, to = InnerConstant.Request.pause)
    private int dictate;   //下载的控制状态

    private DownloadInfo downloadInfo;

    public RequestInfo() {

    }


    protected RequestInfo(Parcel in) {
        dictate = in.readInt();
        downloadInfo = in.readParcelable(DownloadInfo.class.getClassLoader());
    }

    public static final Creator<RequestInfo> CREATOR = new Creator<RequestInfo>() {
        @Override
        public RequestInfo createFromParcel(Parcel in) {
            return new RequestInfo(in);
        }

        @Override
        public RequestInfo[] newArray(int size) {
            return new RequestInfo[size];
        }
    };

    public int getDictate() {
        return dictate;
    }

    public void setDictate(int dictate) {
        this.dictate = dictate;
    }

    public DownloadInfo getDownloadInfo() {
        return downloadInfo;
    }

    public void setDownloadInfo(DownloadInfo downloadInfo) {
        this.downloadInfo = downloadInfo;
    }


    @Override
    public String toString() {
        return "RequestInfo{" +
                "dictate=" + DebugUtils.getRequestDictateDesc(dictate) +
                ", downloadInfo=" + downloadInfo +
                '}';
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(dictate);
        dest.writeParcelable(downloadInfo, flags);
    }
}
